mod mover;

use mover::Mover;
use ggez::{Context, GameResult, GameError, graphics};
pub struct State{
    mover: mover::Mover
}

impl State{
    pub fn new() -> State {
        State{ mover: Mover::new()}
    }
}

impl ggez::event::EventHandler<GameError> for State {
    fn update(&mut self, _ctx: &mut Context) -> GameResult {
        self.mover.update();
        self.mover.check_edges();
        Ok(())
    }
    fn draw(&mut self, ctx: &mut Context) -> GameResult {
        let mut canvas = graphics::Canvas::from_frame(ctx, graphics::Color::WHITE);
        self.mover.display(ctx, &mut canvas);
        canvas.finish(ctx)?;
        Ok(())
    }
}